<?php
class contact extends adminController {
    public $_index = 'admin/contact/index';
    public $_listView = 'admin/contact/list';
    public $_view = 'admin/contact/view';
    
	public function __construct() {
		parent::__construct ();
        $this->session->set_userdata('selectedMenuAdmin', 'contact');
	}
	
    public function loadView($temp) {
        if (!isset($temp['data']))
            $temp['data'] = '';
        $this->load->view('admin/template', $temp);
    }
    
    public function index() {
        $this->_data['template'] = $this->_listView;
        $this->_data['data'] = $this->contactModel->get();
        $this->loadView($this->_data);
    }
    
    public function view($id) {
        $this->_data['template'] = $this->_view;
        $this->_data['data'] = $this->contactModel->read($id);
        $this->loadView($this->_data);
    }
    
    public function delete($id) {
        $this->contactModel->delete($id);
        redirect(base_url().$this->_index);
    }
}
?>